//部分控制器
var app = angular.module('myApp.controllers');

app.controller('reservationIndex', ["$scope", "utilService", "$rootScope", function ($scope, utilService, $rootScope) {
    $scope.shopList = [{id:1,card:'2017 0706 1607 3715 78'},{id:2,card:'2017 0706 1607 3715 78'}];
    /*显示卡券*/
    $scope.showCardItem = null;
    $scope.showCard = function (obj) {
      $scope.showCardItem = obj
    }
    //关闭卡券
    $scope.closeCard = function (obj) {
        $scope.showCardItem = null;
    }
    //点击跳转到详情页
    $scope.showDetail = function (item) {
      //reservationDetail = item;
      utilService.$state.go('reservation.detail');
    }



    $scope.$on('$ionicView.beforeEnter', function () {
        //页面刚加载
        utilService.$ionicLoading.show(HX_CONFIG.loadingBase);
    }, false);
    $scope.$on('$ionicView.afterEnter', function () {
        //如果页面标题不一样就加这个
        // utilService.$rootScope.rootData.title = '这里是标题';
        //页面加载完成
        utilService.$ionicLoading.hide();
    }, false);
    $rootScope.$on('$ionicView.beforeLeave', function (e, ion) {
        //页面离开之前关闭所有弹框
        //alertPopup && alertPopup.close();
    }, false);

}]);
app.controller('reservationDetail', ["$scope", "utilService", "$rootScope", function ($scope, utilService, $rootScope) {

  //reservationDetail = reservationDetail || {id:1,card:'2017 0706 1607 3715 78'}

  $scope.$on('$ionicView.beforeEnter', function () {
    //页面刚加载
    utilService.$ionicLoading.show(HX_CONFIG.loadingBase);
  }, false);
  $scope.$on('$ionicView.afterEnter', function () {
    //如果页面标题不一样就加这个
    // utilService.$rootScope.rootData.title = '这里是标题';
    //页面加载完成
    utilService.$ionicLoading.hide();
  }, false);
  $rootScope.$on('$ionicView.beforeLeave', function (e, ion) {
    //页面离开之前关闭所有弹框
    //alertPopup && alertPopup.close();
  }, false);

}]);
app.factory('reservationDetail',function () {
  return {}
})
